package edu.xja.service.impl;

import edu.xja.dao.BankAccountDao;
import edu.xja.entity.BankAccount;
import edu.xja.service.BankAccountService;
import edu.xja.util.SqlSessionFactoryUtil;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

public class BankAccountServiceImpl implements BankAccountService {
    private BankAccountDao bankAccountDao;

    {
        SqlSessionFactory sqlSessionFactory = SqlSessionFactoryUtil.getSqlSessionFactory();
        SqlSession sqlSession = sqlSessionFactory.openSession(true);
        bankAccountDao = (BankAccountDao) sqlSession.getMapper(BankAccountDao.class);
    }
    public BankAccount getById(Integer id) {
        return bankAccountDao.getById(id);
    }

    public int add(BankAccount bankAccount) {
        return bankAccountDao.add(bankAccount);
    }
}
